﻿Public Class music
    Private Sub Picture_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Picture.MouseUp
        Dim chooserectangle As New Rectangle(32, 24, 200, 32)
        Dim choose As New Region(chooserectangle)
        Dim exitarea As New Region(New Rectangle(213, 425, 60, 46))

        If choose.IsVisible(e.X, e.Y) Then
            My.Computer.Audio.Stop()
            If File.Exists("music/bgm01a.wav") Then
                My.Computer.Audio.Play("music/bgm01a.wav")
            Else
                MessageBox.Show("music/bgm01a.wav不存在", "文件不存在", MessageBoxButtons.OK, MessageBoxIcon.Error)
                Return
            End If
            Dim g As Graphics = Picture.CreateGraphics()
            g.DrawImage(My.Resources.musam, chooserectangle, 0, 0, 200, 32, GraphicsUnit.Pixel)
        End If
        If exitarea.IsVisible(e.X, e.Y) Then
            My.Computer.Audio.Stop()
            Me.Hide()
        End If


    End Sub
End Class
